/*
 * @Author: LiJia
 * @Date: 2021-03-09 17:54:42
 * @LastEditTime: 2021-04-05 14:15:38
 * @LastEditors: LiJia
 * @Description: Description
 * @FilePath: \class-manage-system\miniprogram\pages\components\course-item\course-item.ts
 */
Component({
  properties: {
    item: {
      type: Object,
      value: {}
    },
    index: {
      type: Number,
      value: 0
    }
  },
  data: {

  },
  methods: {
    // 自定义方法
    /**
     * 退出课程
     */
    handleExitCourse() {
      console.log("退出课程")
      let that = this
      wx.showModal({
        title: '提示',
        content: '确定要退出该课程吗？',
        success(res) {
          if (res.confirm) {
            console.log('确定')
            that.triggerEvent('exitCourse', that.data.item)
          } else if (res.cancel) {
            console.log('取消')
          } else {
            console.log('未知错误')
          }
        }
      })
    }
  }
})
